using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMCobranzas
    {
        public BMCobranzas(string coneccion)
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        private Cobranzas oCobranzas = new Cobranzas();
        private List<Cobranzas> listaCobranzas = new List<Cobranzas>();
        private DACobranzas daCobranzas = new DACobranzas();

        #region BMCobranzasGetAll
        public List<Cobranzas> BMCobranzasGetAll(Cobranzas cobranzaD, Cobranzas cobranzaH)
        {
            try
            {
                listaCobranzas = daCobranzas.DACobranzasGetAll(connection, cobranzaD, cobranzaH);
                return listaCobranzas;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMCobranzasGetAllByCliente
        public List<Cobranzas> BMCobranzasGetAllByCliente(Cobranzas cobranzaD, Cobranzas cobranzaH)
        {
            try
            {
                listaCobranzas = daCobranzas.DACobranzasGetAllByCliente(connection, cobranzaD, cobranzaH);
                return listaCobranzas;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMCobranzasGetAllByVenta
        public List<Cobranzas> BMCobranzasGetAllByVenta(Cobranzas cobranzas)
        {
            try
            {
                listaCobranzas = daCobranzas.DACobranzasGetAllByVenta(connection, cobranzas);
                return listaCobranzas;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMCobranzasInsert
        public void BMCobranzasInsert(Cobranzas cobranza)
        {
            try
            {
                daCobranzas.DACobranzasInsert(connection, cobranza);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion
    }
}
